<?php
namespace app\admin\controller;

class Config extends Admin{
    public function __construct(){
        parent::__construct();
        $this->model = 'Config';
        $this->assign("model",$this->model);
    }
    protected function get_where_map(){
        $whereData = [];
        // $whereData = input("param.whereData/s");
        // $whereData = urldecode($whereData);
        // $whereDatas = [];
        // if ($whereData) {
        //     $whereData = explode('&', $whereData);
        //     foreach ($whereData as $v) {
        //         $r = explode('=', $v);
        //         if ($r[0] == 'keywords') {
        //             $whereDatas['id|title|name'] = ['like', '%'.$r[1].'%'];
        //         }else{
        //             $whereDatas[$r[0]] = $r[1];
        //         }
        //     }
        // }
        $keywords = input('param.keywords');
        if ($keywords) {
            $whereData['id|title|name'] = ['like', "%$keywords%"];
        }
        return $whereData;
    }
    public function data_cache(){
        $config = model('Config')->lists();
        cache('DB_CONFIG_DATA',null);
        cache('DB_CONFIG_DATA',$config);
        return json(['status' => 1,'msg'=>'操作成功']);
    }
}